package com.itheima.reggie.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author Joker
 * createTime 2022/12/12 19:34
 */
@Configuration
public class WebMvcSupport extends WebMvcConfigurationSupport {
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        //配置管理端静态页面放行规则
        registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
        //配置客户端静态页面放行规则
        registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor((HandlerInterceptor) new WebMvcSupport()).addPathPatterns();
    }
}
